package com.gaiso.gaisopush.push;

import org.eclipse.paho.client.mqttv3.MqttMessage;

/**
 * Created by WangDongJie on 2017/4/20.
 */

public interface IPushCore {

    void connect(String clientId, String broker) throws Exception;
    boolean isConnected();
    void disconnect() throws Exception;
    void close() throws Exception;
    void keepAlive() throws Exception;
    void publish(String topic, MqttMessage message) throws Exception;
    void subscribe(String topic) throws Exception;
    void unSubscribe(String topic) throws Exception;
    void setCallback(IPushCallback callback);

    interface IPushCallback {
        void messageArrived(String topic, byte[] payload);
    }
}
